{extend name='admin@main'}

{block name="content"}
<div class="think-box-shadow">
    {include file='order_pay/index_search'}
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox nowrap'>
<!--                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>-->
                序号
            </th>
            <th class='text-left nowrap'>会员信息</th>
            <th class='text-left nowrap'>会员手机号</th>
            <th class='text-left nowrap'>添加时间</th>
            <th class='text-left nowrap'>支付总金额</th>
            <th class='text-left nowrap'>支付积分</th>
            <th class='text-left nowrap'>订单状态</th>
            <th class='text-left nowrap'>修改订单状态</th>
            <th class='text-left nowrap'>订单详情</th>
            <th class='text-left nowrap'>操作</th>


        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='list-table-check-td think-checkbox'>
<!--                <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>-->
                {$key+1}
            </td>
            <td class='text-left nowrap'>
                会员Id : {$vo.user.id|default='--'}
                <br>
                {notempty name='vo.user.headimg'}
                <img data-tips-image style="width:20px;height:20px;vertical-align:top" src="{$vo.user.headimg|default=''}" class="margin-right-5">
                {/notempty}
                <div class="inline-block">{$vo.user.nickname|default='--'}</div>
            </td>


            <td class='text-left'>
                {$vo.user.phone|default='--'}
            </td>

            <td class='text-left'>
                {$vo.create_at|format_datetime}
            </td>


            <td class='text-left'>
                {$vo.total_price|default='0'}
            </td>

            <td class='text-left'>
                {$vo.pay_amount|default='0'}
            </td>

            <td class='text-left'>
                {$vo.status_name|raw}
            </td>



            <td >
                <select id="status{$vo.id}" class="statuss" data-id="{$vo.id}">
                    <option value="1" <?php if($vo['status']==1){ echo 'selected'; } ?>>待付款</option>
                    <option value="2" <?php if($vo['status']==2){ echo 'selected'; } ?>>进行中</option>
                    <option value="3" <?php if($vo['status']==3){ echo 'selected'; } ?>>已完成</option>
                    <option value="0" <?php if($vo['status']==0){ echo 'selected'; } ?>>已取消</option>
                </select>

                {if auth("store/order_pay/edit_ziduan")}
                <span style="cursor: pointer; color: blue" onclick="queding('{$vo.id}')">&nbsp;&nbsp;确&nbsp;定&nbsp;&nbsp;</span>
                {else}
                <a data-tips-text="您没有编辑的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">编 辑</a>
                {/if}
            </td>

            <td class='text-left'>
                <?php foreach($vo['order'] as $k =>&$v){ ?>
                <div style="font-weight: bold">
                    {$k+1}、套餐名称：{$v.package.title}
                    {notempty name='v.package.report_image'}
                    <img data-tips-image style="width:20px;height:20px; padding: 5px; vertical-align:top" src="{$v.package.report_image|default=''}" class="margin-right-5">
                    {/notempty}
                    <?php foreach($v['project'] as $kk =>&$vv){ ?>
                    <div style="margin-left: 30px;font-weight: 500">{$kk+1}、项目名称：{$vv.title}</div>
                    <?php }?>
                </div>
                <?php }?>
            </td>

            <td class='text-left'>
                <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("store/order_pay/report")}?order_id={$vo.id}'>编 辑</a>
            </td>

        </tr>
        {/foreach}
        </tbody>
        <script>
            function queding(id) {
                var val = $("#status" + id).val();
                $.ajax({
                    url: "<?php echo url('store/order_pay/edit_ziduan');?>",
                    type: "post",
                    data: {"id": id, 'ziduan': 'status', 'val': val},
                    success: function (data) {
                        alert('操作成功')
                        window.location.reload();
                    }
                })
            }
        </script>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
{/block}

